package com.example.license.client;

import com.example.model.Organization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

@Component
public class OrgRestTemplateClient implements Client {
    @Autowired
    @Qualifier("loadBalancedRestTemplate")
    private RestTemplate restTemplate;


    @Override
    public Organization getOrganization(int id) {
        String url = "http://organization/" + id;
        return restTemplate.getForObject(url, Organization.class);
    }
}
